<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#searchID").bind("click",function(){
		if($("#id").val()==""){
			alert("ID를 입력하세요.");
			return ;
		}
		$("#searchIdForm").submit();
	});
	$("#modifyID").click(function(){
		if($("#id").val()==""){
			alert("ID를 입력하세요.");
			return ;
		}
		$("#modifyIdForm").submit();
	});
	$("#removeID").click(function(){
		if($("#id").val()==""){
			alert("ID를 입력하세요.");
			return ;
		}
		$("#removeIdForm").submit();
	});
	
});
</script>
</head>
<body>
<center>
<c:if test="${not empty message }">
	<font color="red">${message }</font>
</c:if>

<c:choose>
	<c:when test="${ empty sessionScope.user}">
		<form action="/${initParam.context_root}/login.do" method="post">
		<input type="hidden" name="accessType" value=${accessType }>
			<table  cellpadding="3px" border="1px" height="150px">
				<tr bgcolor="lightblue">
					<td colspan="2" align="center"><b>로그인</b>
					</td>
				</tr>
				<tr>
					<td bgcolor="lightgray" width="15px" align="center">ID</td>
					<td><input type="text" name="id"></td>
				</tr>
				<tr>
					<td bgcolor="lightgray">PW</td>
					<td><input type="password" name="password"></td>
				<tr>
					<td colspan="2" align="center">
						<input type="submit" value="로그인"> <input type="reset" value="취소">
					</td>
				</tr>
			</table>
		</form>
	</c:when>
	<c:when test="${ not empty sessionScope.user}">
		<br>
		<a href="/${initParam.context_root}/logout.do">로그아웃</a><br>
	</c:when>
</c:choose>
<br>
<hr>
<input type="button" onclick="location.href='./registerUser.do'" value="회원가입">&nbsp;&nbsp;
<input type="button" onclick="location.href='./allUser.do'" value="회원리스트"><br><hr>
<br>
 <form action="/${initParam.context_root }/oneUser.do" id="searchIdForm" method="post" >
  찾는 아이디를 입력하세요.<br>
 	<input type="text" id="id" name="id" >&nbsp;&nbsp;&nbsp;
 	<input type="button" id="searchID" value="찾기"><input type="reset" value="취소">
 </form>
 <br>
 <form action="/${initParam.context_root }/modifyUserForm.do" id="modifyIdForm" method="post">
 	수정할 아이디를 입력하세요.<br>
 	<input type="text" id="id" name="id" >&nbsp;&nbsp;&nbsp;
 	<input type="button" id="modifyID" value="수정"><input type="reset" value="취소">
 </form>
 <br>
  <form action="/${initParam.context_root }/removeUser.do" id="removeIdForm" method="post">
 	삭제할 아이디를 입력하세요.<br>
 	<input type="text" id="id" name="id" >&nbsp;&nbsp;&nbsp;
 	<input type="button" id="removeID" value="삭제"><input type="reset" value="취소">
 </form>
 <br><hr>
 </center>
</body>
</html>